package com.ck.common.service;

import com.ck.model.common.Department;
import com.ck.model.common.User;
import com.ck.model.common.dto.DepartmentTreeDTO;
import com.ck.model.common.page.PageInfo;
import com.ck.model.common.vo.DepartmentListVO;
import com.ck.model.common.vo.DepartmentSelectListVO;

import javax.servlet.http.HttpServletRequest;
import java.rmi.ServerException;
import java.util.List;

/**
 * 部门Service
 *
 * @author dxy
 * @date 2018/6/21 16:39
 */
public interface DepartmentService {
	/**
	 * 保存部门
	 *
	 * @param department Department
	 * @param request    HttpServletRequest
	 */
	void insertDepartment(Department department, HttpServletRequest request);

	/**
	 * 修改部门
	 *
	 * @param department Department
	 * @param request    HttpServletRequest
	 */
	void updateDepartment(Department department, HttpServletRequest request);

	/**
	 * 通过部门ID获取部门
	 *
	 * @param departmentId 部门ID
	 * @return Department
	 */
	Department getDepartmentById(Long departmentId);

	/**
	 * 部门列表
	 *
	 * @param status         状态
	 * @param departmentName 部门名称
	 * @param companyCode    公司编号
	 * @param pageNum        当前页
	 * @param pageSize       每页条数
	 * @return Page<DepartmentListVO>
	 */
	PageInfo<DepartmentListVO> listDepartment(Integer status, String departmentName, String companyCode, Integer pageNum, Integer pageSize) throws ServerException;

	/**
	 * 获取所有启用的部门
	 *
	 * @return List<DepartmentSelectListVO>
	 */
	List<DepartmentSelectListVO> listDepartmentSelect(String companyCode) throws ServerException;

	/**
	 * 获取部门树列表
	 *
	 * @param companyCode 商家编码
	 * @return List<DepartmentTreeDTO>
	 */
	List<DepartmentTreeDTO> listDepartmentTree(String companyCode) throws ServerException;

    /**
     * 禁用启用部门
     *
     * @param department 待操作的部门
     * @param user       登录的用户
     * @param ip         登录用户的ip
     * @author linqiang
     */
    void enableDisableDepartment(Department department, User user, String ip);
}
